<template>
	<view class="ikz">
    <ikz-loading  :css-data="loading_css"></ikz-loading>
    <view class="ikz-pay">
      <view class="ikz-pay-top">
        <view class="ikz-pay-top-title">
          需要支付金额（元）
        </view>
        <view class="ikz-pay-top-price">
          ￥{{total_price}}
        </view>
      </view>
      <view class="ikz-pay-type">
        <image class="ikz-pay-type-img" src="/static/pay/logo.png"></image>
        <view  class="ikz-pay-type-title">
          微信支付
        </view>
        <image class="ikz-pay-type-select" src="/static/pay/select.png"></image>
      </view>
      <view class="ikz-pay-btn" @click="goPay">
        微信支付
      </view>
    </view>
	</view>
</template>

<script>
  import ikzLoading from '@/pages/Component/Public/Loading/loading.vue';
  var app = getApp();
  import ikz from '@/pages/Common/tools.js';
  export default {
    components: {
      ikzLoading
    },
    data() {
      return {
        loading_css:{
          display:'flex',
        },
        orderid:'',
        total_price:''
       }
    },
    onLoad(options){
      this.orderid = options.orderid;
      this.total_price = options.total_price;
      
    },
    created() {
      // var that = this;
      this.loading_css.display = 'none';
    },
    methods: {
      //请求页面数据 
      goPay() {
        uni.showLoading({
       	  mask: true,
       	  title: '正在请求支付...'
        })
        var path = '/xyb/order/wx_minapp_pay';
        var data = {
          amount: this.total_price,
          orderid: this.orderid
        };
        ikz.post(path, data, res => {
          if (res.data.code) {
            //去支付
            var payment = {
              pay:res.data.data
            }
            ikz.pay(payment,'',(res)=>{
              uni.redirectTo({
                url:'../success/index'
              })
              uni.hideLoading();
            });
          } else {
            uni.showModal({
              title: '提示',
              content: res.data.msg,
              showCancel: false,
              success: function(res) {}
            });
            uni.hideLoading();
          }
          // if(that.pull_status){
          // 	this.$emit("change",'pull');
          // }
        });
      },
      
      
      //跳转至招聘中心
      getRecriut(){
        let url = '/pages/Component/Module/Demand/Program/Recruit/index';
        ikz.nav(url, 'n');
      },

    }
  };
</script>

<style >
  page{
    width: 100%;
    height: 100%;
    background:#F3F3F3;
  }
 .ikz-pay{
   width: 95%;
   margin: 20rpx auto;
 }
 .ikz-pay-top{
   box-sizing: border-box;
   padding: 30rpx;
   width: 100%;
   height: 220rpx;
   background: #fff;
   border-radius: 15rpx;
   line-height: 80rpx;
 }
 .ikz-pay-top-title{
   width: 100%;
   text-align: center;
   font-size: 35rpx;
   color: #888888;
 }
 .ikz-pay-top-price{
   width: 100%;
   text-align: center;
   font-size: 50rpx;
   color: #FBAB7E;
   font-weight: 800;
 }
 .ikz-pay-type{
   box-sizing: border-box;
   padding: 30rpx;
   width: 100%;
   display: flex;
   align-items: center;
   justify-content: space-between;
   background: #fff;
   border-radius: 15rpx;
   margin-top: 20rpx;
 }
 .ikz-pay-type-img{
   width: 80rpx;
   height: 80rpx;
 }
 .ikz-pay-type-title{
   width: 70%;
 }
 .ikz-pay-type-select{
   width: 50rpx;
   height: 50rpx;
 }
 .ikz-pay-btn{
   width: 95%;
   height: 80rpx;
   margin:50rpx auto;
   background: linear-gradient(to right, #FBAB7E, #F8C66D);
   color: #fff;
   border-radius: 50rpx;
   text-align: center;
   line-height: 80rpx;
 }
</style>
